package net.letcode.core.utils.security.up;

import java.security.NoSuchAlgorithmException;
import javax.crypto.Cipher;
import org.bouncycastle.jce.provider.BouncyCastleProvider;

public class CliperInstance {
	private static ThreadLocal<Cipher> cipherTL = new ThreadLocal<Cipher>() {
		protected Cipher initialValue() {
			try {
				return Cipher.getInstance("RSA/ECB/PKCS1Padding", new BouncyCastleProvider());
			} catch (Exception e) {
			}

			return null;
		}
	};

	public static Cipher getInstance() throws NoSuchAlgorithmException, javax.crypto.NoSuchPaddingException {
		return (Cipher) cipherTL.get();
	}
}